// 确保 Vue 实例在 DOM 加载后初始化
new Vue({
    el: '#app', // 挂载 Vue 实例
    data() {
        return {
            tableData: [],
            currentCard: null,
            drawer: false,
            table: false,
            erjiMeuData:[],
        }
    },
    created() {  //钩子函数
        this.getMeuData();
    },
    methods: {
        addTab(xuanzhonghang){
            //
        },
        OpenNew(){

        },
        closeDrawer() {
            this.table = false; // 关闭抽屉框
        },
        openDrawer(){
            this.table=true;
        },
        getMeuData(){
            axios.get('/getMeu')
                .then(response => {
                    this.tableData = response.data;
                })
                .catch(error => {
                    console.error('请求表格数据失败', error);
                });
        },
        setCurrent(row) {
            this.$refs.singleTable.setCurrentRow(row);
        },
        whenClick(row) {
            if(row.fatherCode==null||row.fatherCode==""){row.fatherCode=0;}
            axios.get('/getMeuSonAndSon',{                                                            //刷新二级菜单目录
                params: {
                    fatherCode: row.CID
                }}).then(response => {
                console.log(response.data);
                this.erjiMeuData=response.data;
                this.openDrawer();
            })

        },
        handleCurrentChange(val) {
            this.currentRow = val;
        }
    }
});